<?php
namespace jy_teamshop;
defined('BY_JYA') or exit('error');
/*
	消息提醒
*/
class notice extends \plugin{
	public function notice_fenxiao_add($mid){
		//成为分销商
		if($_SESSION['fenxiao_add'.$mid]){
			return false;
		}
		//先注销
		return false;
		$_SESSION['fenxiao_add'.$mid]=1;
		$template_id=cfc('account')->check_tpl_template('OPENTM207685059','jy_teamshop','成为分销商通知');
		$userinfo=pdo_get('core_members',array('id'=>$mid),array('fromuser','nickname'));
		$message=array(
			'first'=>array('value'=>'您好，您已成功成为['.$this->name.']会员！',"color" => "#4a5077"),
			'keyword1'=>array('title'=>'昵称','value'=>$userinfo['nickname'],"color" => "#4a5077"),
			'keyword2'=>array('title'=>'时间','value'=>date('Y/m/d H:i:s',time()),"color" => "#4a5077"),
			'remark'=>array('value'=>'后续消费将享受折扣优惠，分享有奖励收入，感谢您的使用！！',"color" => "#4a5077"),
		);
		if(!$url){
			//$url=custom_url('jy_teamshop/index/',true);
		}
		cfc('account')->sendtwoNotice($mid,$template_id,$message,$url,'fenxiao_add','jy_teamshop');
	}
	public function notice_fenxiao_xiajiadd($mid,$agent_id=0){
		//分销新增队员提醒
		if(!$this->setting['is_xiajiadd']){
			return false;
		}
		$template_id=cfc('account')->check_tpl_template('OPENTM207685059','jy_teamshop','分销新增队员提醒');
		$userinfo=pdo_get('core_members',array('id'=>$mid),array('fromuser','nickname'));
		$message=array(
			'first'=>array('value'=>'您好，您的团队有新成员加入',"color" => "#4a5077"),
			'keyword1'=>array('title'=>'队员昵称','value'=>$userinfo['nickname'],"color" => "#4a5077"),
			'keyword2'=>array('title'=>'加入时间','value'=>date('Y/m/d H:i:s',time()),"color" => "#4a5077"),
			'remark'=>array('value'=>'您可以到我的团队管理后台，管理您的队员！',"color" => "#4a5077"),
		);
		if(!$url){
			//$url=custom_url('jy_teamshop/index/',true);
		}
		cfc('account')->sendtwoNotice($agent_id,$template_id,$message,$url,'fenxiao_xiajiadd','jy_teamshop');
	}
	public function notice_fenxiao_feeadd($agent_id,$fee=0){
		//分销团队收入提醒
		$template_id=cfc('account')->check_tpl_template('OPENTM207497773','jy_teamshop','分销团队收入提醒');
		$message=array(
			'first'=>array('value'=>'您好，你的队员刚刚为你带来收入如下，请及时查看。',"color" => "#4a5077"),
			'keyword1'=>array('title'=>'收入时间','value'=>date('Y/m/d H:i:s',time()),"color" => "#4a5077"),
			'keyword2'=>array('title'=>'收入金额','value'=>$fee,"color" => "#4a5077"),
			'keyword3'=>array('title'=>'收入积分','value'=>0,"color" => "#4a5077"),
			'remark'=>array('value'=>'点击可查看收入详情。',"color" => "#4a5077"),
		);
		if(!$url){
			$url=custom_url('jy_teamshop/index/',true);
		}
		cfc('account')->sendtwoNotice($agent_id,$template_id,$message,$url,'fenxiao_feeadd','jy_teamshop');
	}
	public function notice_fenxiao_tixian($mid,$fee=0,$typetitle=''){
		//提现申请通知
		$template_id=cfc('account')->check_tpl_template('OPENTM405485000','jy_teamshop','提现申请通知');
		$userinfo=pdo_get('core_members',array('id'=>$mid),array('fromuser','nickname'));
		$message=array(
			'first'=>array('value'=>'您好,提现申请已经收到',"color" => "#4a5077"),
			'keyword1'=>array('title'=>'昵称','value'=>$userinfo['nickname'],"color" => "#4a5077"),
			'keyword2'=>array('title'=>'时间','value'=>date('Y/m/d H:i:s',time()),"color" => "#4a5077"),
			'keyword3'=>array('title'=>'金额','value'=>$fee,"color" => "#4a5077"),
			'keyword4'=>array('title'=>'提现方式','value'=>$typetitle?:'微信',"color" => "#4a5077"),
			'remark'=>array('value'=>'感谢您的使用！！',"color" => "#4a5077"),
		);
		if(!$url){
			$url=custom_url('jy_teamshop/index/',true);
		}
		cfc('account')->sendtwoNotice($mid,$template_id,$message,$url,'fenxiao_tixian','jy_teamshop');
	}
	public function notice_fenxiao_dakuan($mid,$fee=0){
		//打款通知
		$template_id=cfc('account')->check_tpl_template('OPENTM400492077','jy_teamshop','打款通知');
		$userinfo=pdo_get('core_members',array('id'=>$mid),array('fromuser','nickname'));
		$message=array(
			'first'=>array('value'=>'您好,提现申请已打款成功！',"color" => "#4a5077"),
			'keyword1'=>array('title'=>'用户ID','value'=>$userinfo['nickname'],"color" => "#4a5077"),			
			'keyword3'=>array('title'=>'打款金额','value'=>$fee,"color" => "#4a5077"),
			'keyword2'=>array('title'=>'打款时间','value'=>date('Y/m/d H:i:s',time()),"color" => "#4a5077"),
			'remark'=>array('value'=>'感谢您的使用！！',"color" => "#4a5077"),
		);
		if(!$url){
			$url=custom_url('jy_teamshop/index/',true);
		}
		cfc('account')->sendtwoNotice($mid,$template_id,$message,$url,'fenxiao_dakuan','jy_teamshop');
	}
}
